gdkwindow: Fix potential NULL pointer dereference
authorPhilip Withnall <philip.withnall@collabora.co.uk>
Wed, 20 Nov 2013 17:18:16 +0000 (17:18 +0000)
committerPhilip Withnall <philip.withnall@collabora.co.uk>
Mon, 9 Mar 2015 13:41:37 +0000 (13:41 +0000)
gdk_window_ensure_native() can end up with a NULL parent pointer, which
it passes to find_native_parent_above()…but that expects a non-NULL
parent.

Found with scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=712760

gdk/gdkwindow.c

index 9ab1f8a80debcb7e6f35d90d7b4663ddc605dac2..a5174a75d0804528ca22c78a3618ad6da3deb131 100644 (file)
@@ -1110,6 +1110,9 @@ find_native_sibling_above (GdkWindow *parent,
 {
   GdkWindow *w;
 
+  if (!parent)
+    return NULL;
+
   w = find_native_sibling_above_helper (parent, child);
   if (w)
     return w;